﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace BL
{
    public class SmartSync
    {
        private int userId;
        private string deviceId;
        private bool isDevice;
        private string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        private int numberOfMessagesToSend;

        public int NumberOfMessagesToSend
        {
            get { return numberOfMessagesToSend; }
            set { numberOfMessagesToSend = value; }
        }

        public SmartSync(int userId) 
        {
            this.userId = userId;
            //sendMessages();
        }

        public int GetObjectSize(object TestObject)
        {
            BinaryFormatter bf = new BinaryFormatter();
            MemoryStream ms = new MemoryStream();
            byte[] Array;
            bf.Serialize(ms, TestObject);
            Array = ms.ToArray();
            return Array.Length;
        }

        private List<Message> splitIntoChunks(int byteSize, List<Message> list) 
        {
            List<Message> chunk = new List<Message>();

            return chunk;
        }

        private string appendChunk(List<Message> messagelist) 
        {
            StringBuilder sb = new StringBuilder();
            
            return sb.ToString();
        }
    }
}
